'''
Created on Jul 15, 2010
@author: mjbommar

"c:\program files (x86)\mplayer\mencoder.exe" mf://*.png -mf fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o output.avi -ffourcc DX50
'''

import igraph
import graphmovie
import graphmovie.graphSequence
import graphmovie.render2D
import random

seq = graphmovie.graphSequence.graphSequence()

g = igraph.Graph.GRG(5, 3)
g.vs['label'] = map(str, range(g.vcount()))
g.vs[0]['graphmovie_color'] = (0.0, 0.0, 1.0)
g.vs[0]['graphmovie_label'] = 'Index Case'
g.es[0]['graphmovie_label'] = 'First Transmission'
seq.addGraph(g)

edgelist = g.get_edgelist()

for n in range(1,10):
    newTarget1 = random.choice(range(g.vcount()))
    newTarget2 = random.choice(range(g.vcount()))
    edgelist.append((g.vcount(), newTarget1))
    edgelist.append((g.vcount(), newTarget2))
    g = igraph.Graph(edgelist)
    g.vs['label'] = map(str, range(g.vcount()))
    g.vs[0]['graphmovie_color'] = (0.0, 0.0, 1.0)
    g.vs[0]['graphmovie_label'] = 'Index Case'
    g.es[0]['graphmovie_label'] = 'First Transmission'
    seq.addGraph(g)

render = graphmovie.render2D.render2D(seq)
render.calculateLayout()
render.render()